<!DOCTYPE html>
<html>

<head>
    <meta charset="utf-8">
    <meta name="viewport"
          content="maximum-scale=1.0,minimum-scale=1.0,user-scalable=0,width=device-width,initial-scale=1.0"/>
    <meta name="format-detection" content="telephone=no,email=no,date=no,address=no">
    <title>我的</title>
    <link rel="stylesheet" type="text/css" href="__CSS__/api.css"/>
    <link rel="stylesheet" type="text/css" href="__CSS__/aui.css"/>
    <style>
        body {
            background-color: #F4F4F4;
            outline: 0;
            padding: 0.75rem;
        }

        .avatar {
            width: 2.05rem;
            height: 2.05rem;
            margin-right: 0.95rem;
        }

        .avatar img {
            width: 100%;
            height: 100%;
        }

        .top {
            height: 2.05rem;
            line-height: 2.05rem;
            color: #404040;
            font-size: 14px;
            margin-bottom: 1.25rem;
            margin-top: 2.5rem;
        }

        .comment {
            background-color: #fff;
            height: 6.1rem;
        }

        .tit {
            color: #555555;
            font-size: 15px;
            padding-top: 1.45rem;
            padding-bottom: 1.1rem;
            text-align: center;
        }

        .star {
            padding-left: 4.2rem;
        }

        .xing {
            width: 1.125rem;
            height: 1.125rem;
            background: url(__IMG__/star1.png) no-repeat center center;
            background-size: 1.125rem;
            margin-right: 0.675rem;
        }

        .xing1 {
            width: 1.125rem;
            height: 1.125rem;
            background: url(__IMG__/star2.png) no-repeat center center;
            background-size: 1.125rem;
            margin-right: 0.675rem;
        }

        .show {
            color: #555555;
            font-size: 14px;
            margin-top: 0.75rem;
            margin-bottom: 0.675rem;
        }

        input[type="checkbox"] {
            -webkit-appearance: none;
            width: 15px;
            height: 15px;
            vertical-align: middle;
            background: #fff url(__IMG__/check_no.png) no-repeat center center;
            background-size: 15px 15px;
            border-radius: 50%;
            margin-right: 4.5px;
            margin-top: 1.5px;
        }

        input[type="checkbox"]:checked {
            -webkit-appearance: none;
            width: 15px;
            height: 15px;
            vertical-align: middle;
            background: #fff url(__IMG__/choose_yes.png) no-repeat center center;
            background-size: 15px 15px;
            border-radius: 50%;
        }

        .sumbit {
            height: 36px;
            color: #FFFFFF;
            font-size: 15px;
            background: linear-gradient(-127deg, rgba(240, 64, 64, 1), rgba(255, 122, 122, 1));
            text-align: center;
            line-height: 36px;
            border-radius: 2px;
        }
    </style>
    <style>
        .aui-bar-nav{
            background:#F81C6B;
            color:#fff;
            width:100%;
            padding: 0;
            margin: 0;
            position: absolute;
            top:0;
            left: 0;
        }
        .aui-iconfont {
            position: relative;
            font-family: "aui_iconfont" !important;
            font-size: 0.7rem;
            font-style: normal;
            -webkit-font-smoothing: antialiased;
            -moz-osx-font-smoothing: grayscale;
            height: 2.4rem;
        }

        .aui-icon-tu{
            height: 2.4rem;
            width: 49px;
            background: url('__IMG__/left1.png') no-repeat center center;
            background-size: 10px 17.5px;
        }
    </style>
</head>

<body>
<header class="aui-bar aui-bar-nav underLine" id="header">
    <a class="aui-pull-left" onclick="window.history.back(-1);"> <span class="aui-iconfont aui-icon-tu"> </span> </a>
    <div class="aui-title">商品评价</div>
</header>
<div class="flex-wrap top">
    <div class="avatar">
        <img src="{$thumb}" id='imggg'/>
    </div>
    <span id='nameee'>{$name}</span>
</div>
<div class="comment">
    <div class="tit">您对这次购买的商品满意吗？</div>
    <div class="star flex-wrap xing1111">
        <div class="xing"></div>
        <div class="xing"></div>
        <div class="xing"></div>
        <div class="xing"></div>
        <div class="xing"></div>
    </div>
</div>
<div class="show flex-wrap">
    <!--      <div class="flex-con"></div>
            <input type="checkbox">匿名评价-->
</div>
<div class="sumbit" tapmode onclick="addComment()">提交评价</div>
</body>
<script type="text/javascript" src="__JS__/jquery.min.js"></script>
<script type="text/javascript">
    var scoreee = '5';
    var content = '非常满意';
    $('.xing').click(function () {
        var i = $(this).index();
        var fen = i - 0 + 1;
        $('.xing').each(function (ii, vv) {
            if (ii <= i) {
                $('.xing').eq(ii).css('background-image', "url(__IMG__/star1.png)");
            } else {
                $('.xing').eq(ii).css('background-image', "url(__IMG__/star2.png)");
            }
        });
        scoreee = fen;
    });

    //添加
    function addComment() {

        if (scoreee == '5') {
            content = '非常满意';
        } else if (scoreee == '4') {
            content = '满意';
        } else if (scoreee == '1') {
            content = '很差';
        } else {
            content = '一般';
        }

        var parame = {
            score: scoreee,
            content: content,
            order_id: {$oid},
        }
        $.ajax({
            url: '{:url("Orders/commentMyOrder")}',
            data: parame,
            type: 'POST',
            dataType: 'json',
            success: function (returndata) {
                if (returndata.status == 200) {
                    var type = {$type};
                    var oid = {$oid};
                    location.href = '{:url("Orders/myOrderInfo")}?order_id='+oid+'&type='+type;
                } else {
                    alert(returndata.msg)
                }
            },
            error: function () {
                alert('Ajax error!');
            }
        })

    }


</script>

</html>
